Page({

  data: {
    userInfo: null,
  },


  wxlogin(e) {
    let that=this;
    // console.log(e);
    wx.getUserProfile({
      desc: 'desc',
      success(res) {
        wx.login({
          success(res1) {
            wx.request({
              url: 'http://kr.aynakedu.com/api/login',
              data: {
                code: res1.code,
                'userInfo':res.userInfo
              },
              method: "POST",
              success(res2) {
                console.log(res2);
                that.setData({
                  userInfo:res2.data.userInfo,
                })
              }
            })
          },
          fail(){
            console.log("微信登录失败"+Error);
          }
        })
      },
      fail: (res) => {},
    })

  },

 
})